package com.wash.shoes.controller.app;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.R;
import com.wash.shoes.domain.dto.OrderPageListDto;
import com.wash.shoes.domain.vo.OrderDetailVo;
import com.wash.shoes.entity.OrderPo;
import com.wash.shoes.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ljg
 * @since 2024-08-29
 */
@Log4j2
@Api(tags = {"APP-洗护订单"})
@RestController
@RequestMapping("/app/order")
public class OrderAController {

    @Autowired
    OrderService orderService;

    @ApiOperation("获取订单列表")
    @PostMapping("/list")
    public R<Page<OrderDetailVo>> pageList(@RequestBody OrderPageListDto orderPo) {
        Page<OrderDetailVo> page = orderService.pageList(orderPo);
        return R.ok(page);
    }

    @ApiOperation("订单的配件")
    @GetMapping("/orderFittingImg")
    public R<Boolean> shoeCheckIn(String fittingImg, String orderId) {
        OrderPo orderPo = orderService.getById(orderId);
        orderPo.setFittingImg(fittingImg);
        orderService.updateById(orderPo);
        return R.ok(true);
    }


}

